<template>
  <div>
    <el-form v-model="queryObj" label-width="100px" size="large">
      <el-row>
        <el-col :span="7" style="margin-right:15px">
          <el-form-item label="用户名：">
            <el-input v-model.trim="queryObj.userNo" placeholder="请输入用户名" />
          </el-form-item>
        </el-col>
        <el-col :span="7" style="margin-right:15px">
          <el-form-item label="账号：">
            <el-input v-model.trim="queryObj.userName" placeholder="请输入账号" />
          </el-form-item>
        </el-col>
        <el-col v-show="isopen" :span="7" style="margin-right:15px">
          <el-form-item label="角色：">
            <el-select v-model="queryObj.roleId" style="width:100%" placeholder="请选择角色">
              <el-option v-for="item in roleList" :key="item.id" :label="item.roleName" :value="item.id" />
            </el-select>
          </el-form-item>
        </el-col>
        <searchbutton :isopen="isopen" @isopenclickfn="isopenclick" @resetQueryfn="resetQueryfn" @queryClickfn="queryClickfn" />

        <!-- <el-col :span="6" style="float:right">
          <el-button type="primary" @click="queryClickfn">查询</el-button>
          <el-button @click="resetQueryfn">重置</el-button>
          <el-button type="text" @click="isopen = !isopen">{{
            isopen ? "收起" : "展开"
          }}</el-button>
        </el-col> -->
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    queryObj: {
      type: Object,
      required: true,
    },
    roleList: {
      type: Array,
      required: true,
    },
  },
  data() {
    return {
      isopen: false,
    };
  },
  methods: {
    // 搜索按钮
    queryClickfn() {
      this.$emit("queryClickfn");
    },
    // 重置
    resetQueryfn() {
      this.$emit("resetQueryfn");
    },
    // 展开收起
    isopenclick() {
      this.isopen = !this.isopen;
    },
  },
};
</script>

<style>
</style>
